//
//  CXPhotoAsset.m
//  Asman
//
//  Created by 李旭峰 on 6/4/19.
//  Copyright © 2019 李旭峰. All rights reserved.
//

#import "CXPhotoAsset.h"

@implementation CXPhotoAsset
- (instancetype)initWithType:(CXAssetType)type path:(NSString *)path title:(NSString *)title{
  if (self = [super init]) {
    _type = type;
    _path = path;
    _title = title;
    if (type == CXAssetTypeImage) {
      _path = [NSString stringWithFormat:@"%@",path];
    }
  }
  return self;
}
- (instancetype)initWithThumbnail:(UIImage *)thumbnailImage title:(NSString *)title{
    if (self = [super init]) {
      _type = CXAssetTypeImage;
      _title = title;
      self.thumbnail = thumbnailImage;
    }
    return self;
}
- (instancetype)initWithType:(CXAssetType)type path:(NSString *)path{
    if (self = [super init]) {
        _type = type;
        _path = path;
        _title = @"";
        if (type == CXAssetTypeImage) {
            _path = [NSString stringWithFormat:@"%@",path];// [NSString stringWithFormat:@"%@?x-oss-process=image/resize,h_300,p_70",path];
        }
    }
    return self;
}
- (instancetype)initWithThumbnail:(UIImage *)thumbnailImage{
    if (self = [super init]) {
        _type = CXAssetTypeImage;
        _title = @"";
        self.thumbnail = thumbnailImage;
    }
    return self;
}
- (instancetype)initWithAsset:(PHAsset *)asset type:(CXAssetType)type{
    if (self = [super init]) {
        _type = type;
        _asset = asset;
    }
    return self;
}
@end

